{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 熊猫(pandas)简介\n",
    "* 来源: [官方英文新手教程](https://pandas.pydata.org/pandas-docs/version/1.0.2/getting_started/index.html#getting-started)\n",
    "* 课堂教学方式：\n",
    "   * 分段式以英文新手教程的内容做示范及说明\n",
    "   * 课堂上以实际中文数据做操练，每段约10-15分钟\n",
    "   * 抽学生联mic自播说明难点及成果点，教师总结\n",
    "* 关於新旧内容\n",
    "   * 旧Python内容若有不熟处，会按课堂教学实际状况记录后，在往后的课程补充\n",
    "   * 新Pandas内容请大家以下操演的心法及剑法学习\n",
    "       * **将代码当成人类语言**用**片语化**记忆，并配合\n",
    "       * **将数据处理输入输出**用**视觉语言**记忆\n",
    "       \n",
    "![02_io_readwrite](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/02_io_readwrite.svg)\n",
    "\n",
    "* 以上为官方英文新手教程例子，数据处理\n",
    "  * 输入有  **read_叉叉**  方法  \n",
    "  * 输出有  **to_叉叉**  方法  \n",
    "  * 可配合多种数据做输入输出\n",
    "  * 片语法记忆：以常用之csv及xlsx输入输出为例\n",
    "     * 数据框.read_csv( 档名, 参数 ... )\n",
    "     * 数据框.read_excel( 档名, 参数 ... )\n",
    "     * 数据框.to_csv( 档名, 参数 ... )\n",
    "     * 数据框.to_excel( 档名, 参数 ... )\n",
    "  * 人类语言片语化，可组合\n",
    "     * 输入 数据框.read_支援的格式名\n",
    "     * 输出 数据框.to_支援的格式名\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>\n",
       "/* 本电子讲义使用之CSS */\n",
       "div.code_cell {\n",
       "    background-color: #e5f1fe;\n",
       "}\n",
       "div.cell.selected {\n",
       "    background-color: #effee2;\n",
       "    font-size: 2rem;\n",
       "    line-height: 2.4rem;\n",
       "}\n",
       "div.cell.selected .rendered_html table {\n",
       "    font-size: 2rem !important;\n",
       "    line-height: 2.4rem !important;\n",
       "}\n",
       ".rendered_html pre code {\n",
       "    background-color: #C4E4ff;   \n",
       "    padding: 2px 25px;\n",
       "}\n",
       ".rendered_html pre {\n",
       "    background-color: #99c9ff;\n",
       "}\n",
       "div.code_cell .CodeMirror {\n",
       "    font-size: 2rem !important;\n",
       "    line-height: 2.4rem !important;\n",
       "}\n",
       ".rendered_html img, .rendered_html svg {\n",
       "    max-width: 45%;\n",
       "    height: auto;\n",
       "    float: right;\n",
       "}\n",
       "/* Gradient transparent - color - transparent */\n",
       "hr {\n",
       "    border: 0;\n",
       "    border-bottom: 1px dashed #ccc;\n",
       "}\n",
       ".emoticon{\n",
       "    font-size: 5rem;\n",
       "    line-height: 4.4rem;\n",
       "    text-align: center;\n",
       "    vertical-align: middle;\n",
       "}\n",
       "</style>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<style>\n",
    "/* 本电子讲义使用之CSS */\n",
    "div.code_cell {\n",
    "    background-color: #e5f1fe;\n",
    "}\n",
    "div.cell.selected {\n",
    "    background-color: #effee2;\n",
    "    font-size: 2rem;\n",
    "    line-height: 2.4rem;\n",
    "}\n",
    "div.cell.selected .rendered_html table {\n",
    "    font-size: 2rem !important;\n",
    "    line-height: 2.4rem !important;\n",
    "}\n",
    ".rendered_html pre code {\n",
    "    background-color: #C4E4ff;   \n",
    "    padding: 2px 25px;\n",
    "}\n",
    ".rendered_html pre {\n",
    "    background-color: #99c9ff;\n",
    "}\n",
    "div.code_cell .CodeMirror {\n",
    "    font-size: 2rem !important;\n",
    "    line-height: 2.4rem !important;\n",
    "}\n",
    ".rendered_html img, .rendered_html svg {\n",
    "    max-width: 45%;\n",
    "    height: auto;\n",
    "    float: right;\n",
    "}\n",
    "/* Gradient transparent - color - transparent */\n",
    "hr {\n",
    "    border: 0;\n",
    "    border-bottom: 1px dashed #ccc;\n",
    "}\n",
    ".emoticon{\n",
    "    font-size: 5rem;\n",
    "    line-height: 4.4rem;\n",
    "    text-align: center;\n",
    "    vertical-align: middle;\n",
    "}\n",
    "</style>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![01_table_dataframe.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/01_table_dataframe.svg)\n",
    "\n",
    "# 本周内容\n",
    "本周内容共分6段(5段+1段下周预告)，新手请认真记忆并操练，老手有彩蛋项目去实践\n",
    "\n",
    "* [熊猫处理什么样的数据？](#熊猫处理什么样的数据？)\n",
    "\n",
    "> <mark>框框框</mark>，探索，清理和处理数据在Pandas中，数据表称为DataFrame，数据科学家**变数variables**通常放(竖着的列)column，**观察observations**通常放(横着的行)row\n",
    "\n",
    "<br/><br/><br/>\n",
    "\n",
    "-----\n",
    "\n",
    "![02_io_readwrite.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/02_io_readwrite.svg)\n",
    "\n",
    "* [如何读写表格数据？](#如何读写表格数据？)\n",
    "\n",
    "> <mark>读读读，写写写</mark>，数据科学家不想浪费时间编程去处理不同数据格式，所以pandas集成了常用的现成的文件格式或数据源（csv，excel，sql，json，parquet等）...\n",
    "\n",
    "-----\n",
    "\n",
    "![03_subset_columns_rows.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/03_subset_columns_rows.svg)\n",
    "\n",
    "* [如何选择表格的子集？](#如何选择表格的子集？)\n",
    "\n",
    "> <mark>切切切</mark>，**切片** (英文叫slice) 是数据科学家找突破点的重要工具，是她们的数据解剖刀...\n",
    "\n",
    "-----\n",
    "\n",
    "![04_plot_overview.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/04_plot_overview.svg)\n",
    "\n",
    "* [如何在熊猫中绘图？](#如何在熊猫中绘图？)\n",
    "\n",
    "> <mark>绘绘绘</mark>，**绘图** ( 数据框.plot() ) 是数据科学家**以数据框为中心**的代码实践，减少以图表类型为开头的编程思维来作图\n",
    "\n",
    "-----\n",
    "\n",
    "![05_newcolumn_2.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/05_newcolumn_2.svg)\n",
    "\n",
    "* [如何从现有列创建派生新列？](#如何从现有列创建派生新列？)\n",
    "\n",
    "> <mark>列列列</mark>，派生新列意谓着变数variables的进一部转换，是数据科学家按步就班做ETL的过程，新派生列就是**变数variables**的转换\n",
    "\n",
    "-----\n",
    "\n",
    "![06_groupby.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/06_groupby.svg)\n",
    "\n",
    "* [如何计算汇总描述性统计信息？](#如何计算汇总描述性统计信息？)\n",
    "\n",
    "> <mark>算算算</mark>，描述性统计竟然代码可以这麽容易....，但难的仍是在数据科学家的数据定义及解释上\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![01_table_dataframe.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/01_table_dataframe.svg)\n",
    "## 熊猫处理什么样的数据？\n",
    "\n",
    "> <mark>框框框</mark>，探索，清理和处理数据在Pandas中，数据表称为DataFrame\n",
    "\n",
    "\n",
    "对数据科学家来说: \n",
    "\n",
    "* 竖着的列column通常放**变数variables**\n",
    "* 横着的行row通常放**观察observations**\n",
    "\n",
    "对数据及信息管理人员来说:\n",
    "* 表格数据（例如存储在电子表格或数据库中的数据）是很常见的，最主流的数据结构和查询语言是SQL\n",
    "* 树状文本数据（例如HTML, XML, JSON数据）是很常见的，HTML/XML最主流的查询语言是xpath\n",
    "\n",
    "<div class=\"emoticon\">🐷🙈🙉🙊🐷</div>\n",
    "\n",
    "<div class=\"emoticon\">🙈🐷🙉🐷🙊</div>\n",
    "\n",
    "<div class=\"emoticon\">🐷🙈🐷🙊🐷</div>\n",
    "\n",
    "----- \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 框框框的代码片语\n",
    "框框框的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "```python\n",
    "框框 = pd.DataFrame ( {\n",
    "        \"变数X\": [\"观察X1\", \"观察X2\", \"观察X3\", \"观察X4\"],\n",
    "        \"变数Y\": [\"观察Y1\", \"观察Y2\", \"观察Y3\", \"观察Y4\"],\n",
    "        \"变数Z\": [\"观察Z1\", \"观察Z2\", \"观察Z3\", \"观察Z4\"],\n",
    "      } )```\n",
    "\n",
    "记得，像人类语言一样，说的清楚，人就可以读的比较清楚....\n",
    "\n",
    "* pd.DataFrame 的主流参数是字典\n",
    "* 该字典的键keys是由变数构成，相当於表格中一行行的标题\n",
    "* 该字典的值values是由观察的列表构成，相当於表格中一行行的数据\n",
    "* 表格真的要是表格, 该字典的每个观察的列表数量必需齐一\n",
    "\n",
    "[小贴士] 最后一个逗点可有可无(为什麽?)，在pandas情境下最好留(为什麽?)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 框框框的课堂练习\n",
    "新手请认真记忆并操练 \n",
    "#### 练习A1-框框框的课堂建构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>变数X</th>\n",
       "      <th>变数Y</th>\n",
       "      <th>变数Z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>观察X1</td>\n",
       "      <td>观察Y1</td>\n",
       "      <td>观察Z1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>观察X2</td>\n",
       "      <td>观察Y2</td>\n",
       "      <td>观察Z2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>观察X3</td>\n",
       "      <td>观察Y3</td>\n",
       "      <td>观察Z3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>观察X4</td>\n",
       "      <td>观察Y4</td>\n",
       "      <td>观察Z4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    变数X   变数Y   变数Z\n",
       "0  观察X1  观察Y1  观察Z1\n",
       "1  观察X2  观察Y2  观察Z2\n",
       "2  观察X3  观察Y3  观察Z3\n",
       "3  观察X4  观察Y4  观察Z4"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "做别的事去了\n"
     ]
    }
   ],
   "source": [
    "# A1\n",
    "框框 = pd.DataFrame ( {\n",
    "        \"变数X\": [\"观察X1\", \"观察X2\", \"观察X3\", \"观察X4\"],\n",
    "        \"变数Y\": [\"观察Y1\", \"观察Y2\", \"观察Y3\", \"观察Y4\"],\n",
    "        \"变数Z\": [\"观察Z1\", \"观察Z2\", \"观察Z3\", \"观察Z4\"],\n",
    "      } )\n",
    "display (框框)\n",
    "print(\"做别的事去了\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>变数X</th>\n",
       "      <th>变数Y</th>\n",
       "      <th>变数Z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>观察X1</td>\n",
       "      <td>观察Y1</td>\n",
       "      <td>观察Z1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>观察X2</td>\n",
       "      <td>观察Y2</td>\n",
       "      <td>观察Z2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>观察X3</td>\n",
       "      <td>观察Y3</td>\n",
       "      <td>观察Z3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>观察X4</td>\n",
       "      <td>观察Y4</td>\n",
       "      <td>观察Z4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    变数X   变数Y   变数Z\n",
       "0  观察X1  观察Y1  观察Z1\n",
       "1  观察X2  观察Y2  观察Z2\n",
       "2  观察X3  观察Y3  观察Z3\n",
       "3  观察X4  观察Y4  观察Z4"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A1 dict\n",
    "# 先弄字典, 再弄 框框 的写法片语\n",
    "字典 = {\n",
    "        \"变数X\": [\"观察X1\", \"观察X2\", \"观察X3\", \"观察X4\"],    \n",
    "        \"变数Y\": [\"观察Y1\", \"观察Y2\", \"观察Y3\", \"观察Y4\"],\n",
    "        \"变数Z\": [\"观察Z1\", \"观察Z2\", \"观察Z3\", \"观察Z4\"],\n",
    "       }\n",
    "\n",
    "框框 = pd.DataFrame ( 字典 )\n",
    "框框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    变数X   变数Y   变数Z\n",
      "0  观察X1  观察Y1  观察Z1\n",
      "1  观察X2  观察Y2  观察Z2\n",
      "2  观察X3  观察Y3  观察Z3\n",
      "3  观察X4  观察Y4  观察Z4\n"
     ]
    }
   ],
   "source": [
    "# A1 print\n",
    "# 在ipynb用 print比较不上看，因为是文字text输出为主\n",
    "print (框框)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>变数X</th>\n",
       "      <th>变数Y</th>\n",
       "      <th>变数Z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>观察X1</td>\n",
       "      <td>观察Y1</td>\n",
       "      <td>观察Z1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>观察X2</td>\n",
       "      <td>观察Y2</td>\n",
       "      <td>观察Z2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>观察X3</td>\n",
       "      <td>观察Y3</td>\n",
       "      <td>观察Z3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>观察X4</td>\n",
       "      <td>观察Y4</td>\n",
       "      <td>观察Z4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    变数X   变数Y   变数Z\n",
       "0  观察X1  观察Y1  观察Z1\n",
       "1  观察X2  观察Y2  观察Z2\n",
       "2  观察X3  观察Y3  观察Z3\n",
       "3  观察X4  观察Y4  观察Z4"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# A1 display\n",
    "# 在ipynb可用 display 比较上看\n",
    "\n",
    "from IPython.display import display, HTML\n",
    "# 從 IPython.display 模塊 導入使用 display和HTML\n",
    "display (框框)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 练习A1_post-框框框的课堂后练习\n",
    "\n",
    "老手有彩蛋项目可实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>变数X</th>\n",
       "      <th>变数Y</th>\n",
       "      <th>变数Z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>观察X1</td>\n",
       "      <td>观察Y1</td>\n",
       "      <td>观察Z1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>观察X2</td>\n",
       "      <td>观察Y2</td>\n",
       "      <td>观察Z2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>观察X3</td>\n",
       "      <td>观察Y3</td>\n",
       "      <td>观察Z3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>观察X4</td>\n",
       "      <td>观察Y4</td>\n",
       "      <td>观察Z4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    变数X   变数Y   变数Z\n",
       "0  观察X1  观察Y1  观察Z1\n",
       "1  观察X2  观察Y2  观察Z2\n",
       "2  观察X3  观察Y3  观察Z3\n",
       "3  观察X4  观察Y4  观察Z4"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A1 bonus\n",
    "# 已有此字典, 你能用代码生产同样的框框吗？\n",
    "字典 = {\n",
    "        \"变数\": [\"观察1\", \"观察2\", \"观察3\"],\n",
    "       }\n",
    "\n",
    "# 你的代码\n",
    "\n",
    "框框"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "新手请认真记忆并操练，\n",
    "#### 练习A2-**框框框**(DataFrame)的取变数成 **系列** (Series)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    观察X1\n",
       "1    观察X2\n",
       "2    观察X3\n",
       "3    观察X4\n",
       "Name: 变数X, dtype: object"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A2 Series\n",
    "# first slice\n",
    "框框 [\"变数X\"]  # [] 像字典取值, 改值从列表升级为有**索引的序列**\n",
    "# object 对象/物件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['观察X1', '观察X2', '观察X3', '观察X4'], dtype=object)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A2 Series values\n",
    "框框 [\"变数X\"].values # 值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=4, step=1)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A2 Series index\n",
    "框框 [\"变数X\"].index # 索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(框框 [\"变数X\"].index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "变数X    观察X4\n",
       "变数Y    观察Y4\n",
       "变数Z    观察Z4\n",
       "Name: 3, dtype: object"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A2 DataFrame .loc[]\n",
    "# 用 .loc[] 取列, 相当於所有变数的某一次观察\n",
    "框框.loc[3]   # loc = location  row"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['观察X1', '观察X2', '观察X3', '观察X4']\n",
      "['观察X1', '观察X2', '观察X3', '观察X4']\n",
      "['观察X1', '观察X2', '观察X3', '观察X4']\n",
      "[0, 1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "# A2 Series to_list()\n",
    "# 降阶打击, 变列表的方法\n",
    "print ( 框框 [\"变数X\"].to_list() )    \n",
    "print ( list(框框 [\"变数X\"]) )\n",
    "print ( list(框框 [\"变数X\"].values) )\n",
    "print ( list(框框 [\"变数X\"].index) )\n",
    "\n",
    "# 区分读/写代码: \n",
    "# 你可以挑一个你比较常用的\"说法\", \n",
    "# 但你看到别人不同的说法时, 你需要知道是同一件事"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![01_table_dataframe.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/01_table_dataframe.svg)\n",
    "### 框框框的小结\n",
    "以下为廖老师示范，其它小结需要自己做小结\n",
    "1. 对数据科学来说，表格数据的习惯是变数variables与观察observations\n",
    "2. 在Pandas框框框的建构来说，就是可以把变数和观察用索引的方式使用\n",
    "3. 框框框的字典取的是某个变数所有观察, 用.loc[]取數次观察的所有变数\n",
    "  * .loc[] 取  观察, 行 column\n",
    "  * [\"\"] 取  变数, 列 row\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![02_io_readwrite.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/02_io_readwrite.svg)\n",
    "## 如何读写表格数据？\n",
    "读读读，写写写，数据科学家不想浪费时间编程去处理不同数据格式，所以pandas集成了常用的现成的文件格式或数据源（csv，excel，sql，json，parquet等）..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 框框框的课堂练习\n",
    "新手请认真记忆并操练 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读读读的代码片语\n",
    "读读读的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "```python\n",
    "\n",
    "读到csv = pd.read_csv(\"路径档案名\", encoding=\"utf8\")\n",
    "读到tsv = pd.read_csv(\"路径档案名\", encoding=\"utf8\", sep=\"\\t\")\n",
    "读到excel = pd.read_excel(\"路径档案名\", sheet_name=\"分页名称\")\n",
    "```\n",
    "\n",
    "代码片语说明\n",
    "\n",
    "你可否查到[最新的文档](https://pandas.pydata.org/pandas-docs/version/1.0.2/)的说明，用markdown语法编辑在此，并看一些有什麽参数可以使用，自己学者做笔记\n",
    "\n",
    "* pd.read_csv\n",
    "* pd.read_excel\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>Ant Financial</td>\n",
       "      <td>10000</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>2014</td>\n",
       "      <td>春华资本、中投海外、红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>Bytedance</td>\n",
       "      <td>5000</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>媒体和娱乐</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>2012</td>\n",
       "      <td>红杉资本、海纳亚洲、纪源资本、启明创投</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>Didi Chuxing</td>\n",
       "      <td>3600</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "      <td>程维</td>\n",
       "      <td>2012</td>\n",
       "      <td>腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Infor</td>\n",
       "      <td>Infor</td>\n",
       "      <td>3500</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>云计算</td>\n",
       "      <td>Jim Schaper</td>\n",
       "      <td>2002</td>\n",
       "      <td>Golden Gate Capital, Koch Equity Development</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>JUUL Labs</td>\n",
       "      <td>JUUL Labs</td>\n",
       "      <td>3400</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>消费品</td>\n",
       "      <td>Adam Bowen, James Monsees, Kevin Burns, Tim Da...</td>\n",
       "      <td>2015</td>\n",
       "      <td>M13, Timothy Davis, Evolution VC Partners, Tig...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   排名       企业名称   Company Name  估值（亿人民币）  国家   城市     行业  \\\n",
       "0   1       蚂蚁金服  Ant Financial     10000  中国   杭州   金融科技   \n",
       "1   2       字节跳动      Bytedance      5000  中国   北京  媒体和娱乐   \n",
       "2   3       滴滴出行   Didi Chuxing      3600  中国   北京   共享经济   \n",
       "3   4      Infor          Infor      3500  美国   纽约    云计算   \n",
       "4   5  JUUL Labs      JUUL Labs      3400  美国  旧金山    消费品   \n",
       "\n",
       "                                             掌门人/创始人  成立年份  \\\n",
       "0                                                井贤栋  2014   \n",
       "1                                                张一鸣  2012   \n",
       "2                                                 程维  2012   \n",
       "3                                        Jim Schaper  2002   \n",
       "4  Adam Bowen, James Monsees, Kevin Burns, Tim Da...  2015   \n",
       "\n",
       "                                              部分投资机构  \n",
       "0                                     春华资本、中投海外、红杉资本  \n",
       "1                                红杉资本、海纳亚洲、纪源资本、启明创投  \n",
       "2                             腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本  \n",
       "3       Golden Gate Capital, Koch Equity Development  \n",
       "4  M13, Timothy Davis, Evolution VC Partners, Tig...  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# B1 20春_pandas_week02_hurun_unicorn.tsv\n",
    "df = pd.read_csv(\"20春_pandas_week02_hurun_unicorn.tsv\", encoding=\"utf8\", sep=\"\\t\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "      <th>region</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>Ant Financial</td>\n",
       "      <td>10000</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>2014</td>\n",
       "      <td>春华资本、中投海外、红杉资本</td>\n",
       "      <td>环杭州湾大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>Bytedance</td>\n",
       "      <td>5000</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>媒体和娱乐</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>2012</td>\n",
       "      <td>红杉资本、海纳亚洲、纪源资本、启明创投</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>Didi Chuxing</td>\n",
       "      <td>3600</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "      <td>程维</td>\n",
       "      <td>2012</td>\n",
       "      <td>腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6</td>\n",
       "      <td>陆金所</td>\n",
       "      <td>Lufax</td>\n",
       "      <td>2700</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>计葵生</td>\n",
       "      <td>2011</td>\n",
       "      <td>摩根士丹利、中银集团、国泰君安（香港）</td>\n",
       "      <td>环杭州湾大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>11</td>\n",
       "      <td>微众银行</td>\n",
       "      <td>WeBank</td>\n",
       "      <td>1500</td>\n",
       "      <td>中国</td>\n",
       "      <td>深圳</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>顾敏</td>\n",
       "      <td>2014</td>\n",
       "      <td>腾讯、华平投资、淡马锡</td>\n",
       "      <td>粤港澳大湾区</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   排名  企业名称   Company Name  估值（亿人民币）  国家  城市     行业 掌门人/创始人  成立年份  \\\n",
       "0   1  蚂蚁金服  Ant Financial     10000  中国  杭州   金融科技     井贤栋  2014   \n",
       "1   2  字节跳动      Bytedance      5000  中国  北京  媒体和娱乐     张一鸣  2012   \n",
       "2   3  滴滴出行   Didi Chuxing      3600  中国  北京   共享经济      程维  2012   \n",
       "3   6   陆金所          Lufax      2700  中国  上海   金融科技     计葵生  2011   \n",
       "4  11  微众银行         WeBank      1500  中国  深圳   金融科技      顾敏  2014   \n",
       "\n",
       "                   部分投资机构   region  \n",
       "0          春华资本、中投海外、红杉资本  环杭州湾大湾区  \n",
       "1     红杉资本、海纳亚洲、纪源资本、启明创投    渤海大湾区  \n",
       "2  腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本    渤海大湾区  \n",
       "3     摩根士丹利、中银集团、国泰君安（香港）  环杭州湾大湾区  \n",
       "4             腾讯、华平投资、淡马锡   粤港澳大湾区  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# B2 20春_pandas_week02_hurun_unicorn_more.csv\n",
    "df = pd.read_csv(\"20春_pandas_week02_hurun_unicorn_more.csv\", encoding=\"utf8\", sep=\"\\t\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>Ant Financial</td>\n",
       "      <td>10000</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>2014</td>\n",
       "      <td>春华资本、中投海外、红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>Bytedance</td>\n",
       "      <td>5000</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>媒体和娱乐</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>2012</td>\n",
       "      <td>红杉资本、海纳亚洲、纪源资本、启明创投</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>Didi Chuxing</td>\n",
       "      <td>3600</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "      <td>程维</td>\n",
       "      <td>2012</td>\n",
       "      <td>腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Infor</td>\n",
       "      <td>Infor</td>\n",
       "      <td>3500</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>云计算</td>\n",
       "      <td>Jim Schaper</td>\n",
       "      <td>2002</td>\n",
       "      <td>Golden Gate Capital, Koch Equity Development</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>JUUL Labs</td>\n",
       "      <td>JUUL Labs</td>\n",
       "      <td>3400</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>消费品</td>\n",
       "      <td>Adam Bowen, James Monsees, Kevin Burns, Tim Da...</td>\n",
       "      <td>2015</td>\n",
       "      <td>M13, Timothy Davis, Evolution VC Partners, Tig...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   排名       企业名称   Company Name  估值（亿人民币）  国家   城市     行业  \\\n",
       "0   1       蚂蚁金服  Ant Financial     10000  中国   杭州   金融科技   \n",
       "1   2       字节跳动      Bytedance      5000  中国   北京  媒体和娱乐   \n",
       "2   3       滴滴出行   Didi Chuxing      3600  中国   北京   共享经济   \n",
       "3   4      Infor          Infor      3500  美国   纽约    云计算   \n",
       "4   5  JUUL Labs      JUUL Labs      3400  美国  旧金山    消费品   \n",
       "\n",
       "                                             掌门人/创始人  成立年份  \\\n",
       "0                                                井贤栋  2014   \n",
       "1                                                张一鸣  2012   \n",
       "2                                                 程维  2012   \n",
       "3                                        Jim Schaper  2002   \n",
       "4  Adam Bowen, James Monsees, Kevin Burns, Tim Da...  2015   \n",
       "\n",
       "                                              部分投资机构  \n",
       "0                                     春华资本、中投海外、红杉资本  \n",
       "1                                红杉资本、海纳亚洲、纪源资本、启明创投  \n",
       "2                             腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本  \n",
       "3       Golden Gate Capital, Koch Equity Development  \n",
       "4  M13, Timothy Davis, Evolution VC Partners, Tig...  "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# B3 20春_pandas_week02_hurun_unicorn.xlsx\n",
    "df = pd.read_excel(\"20春_pandas_week02_hurun_unicorn.xlsx\", encoding=\"utf8\", sheet_name=\"独角兽\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# B4 df.head()\n",
    "# B5 df.info()\n",
    "# B6 df.shape\n",
    "# B7 df.describe(include=\"all\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "# B8 df.to_markdown()\n",
    "# B9 df.to_html()\n",
    "# B10 df.to_json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'排名': {'count': 494.0,\n",
       "  'mean': 180.97773279352228,\n",
       "  'std': 91.07319075981641,\n",
       "  'min': 1.0,\n",
       "  '25%': 84.0,\n",
       "  '50%': 224.0,\n",
       "  '75%': 264.0,\n",
       "  'max': 264.0},\n",
       " '估值（亿人民币）': {'count': 494.0,\n",
       "  'mean': 238.80566801619435,\n",
       "  'std': 623.1585372633193,\n",
       "  'min': 70.0,\n",
       "  '25%': 70.0,\n",
       "  '50%': 100.0,\n",
       "  '75%': 200.0,\n",
       "  'max': 10000.0},\n",
       " '成立年份': {'count': 494.0,\n",
       "  'mean': 2011.2348178137652,\n",
       "  'std': 3.7924771092178786,\n",
       "  'min': 2000.0,\n",
       "  '25%': 2009.0,\n",
       "  '50%': 2012.0,\n",
       "  '75%': 2014.0,\n",
       "  'max': 2019.0}}"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe().to_dict()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# B11 df.to_dict()\n",
    "# B12 df.to_sql()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 练习B1_post-读读读的课堂后练习\n",
    "\n",
    "老手有彩蛋项目可实践\n",
    "\n",
    "IMF有[2020年1月的《世界经济展望》](https://www.imf.org/zh/Publications/WEO/Issues/2020/01/20/weo-update-january2020)，而这数据集的前一份版本都可以在其[数据入口取得](https://www.imf.org/en/data)的EXCEL数据可以下载，共用三种形式，你能用正确的参数取得数据框吗? \n",
    "* “SDMX Data” [全数据](https://www.imf.org/external/pubs/ft/weo/2019/02/weodata/download.aspx) [zip](https://www.imf.org/external/pubs/ft/weo/2019/02/weodata/WEOOct2019_SDMXData.zip)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# B1 bonus\n",
    " \n",
    "# 你的代码\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![02_io_readwrite.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/02_io_readwrite.svg)\n",
    "### 读读读的小结\n",
    "1. 1\n",
    "2. 2\n",
    "3. 3\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![03_subset_columns_rows.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/03_subset_columns_rows.svg)\n",
    "## 如何选择表格的子集？  \n",
    "\n",
    "切切切，**切片** (英文叫slice) 是数据科学家找突破点的重要工具，是她们的数据解剖刀...\n",
    "\n",
    "参考 CheatSheet \n",
    "* Subset Observations (Rows) 列\n",
    "* Subset Variables (Columns) 行\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 切切切的代码片语\n",
    "切切切的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "\n",
    "####  列子集\n",
    "```python\n",
    "\n",
    "df.loc()\n",
    "df.iloc()\n",
    "df.set_index()\n",
    "df.head(n)\n",
    "df.tail(n)\n",
    "df.nlargest(n, '变量')\n",
    "df.nsmallest(n, '变量')\n",
    "df[df.估值（亿人民币）> 10]\n",
    "```\n",
    "\n",
    "#### 行子集\n",
    "```python\n",
    "\n",
    "#  行子集\n",
    "df[['变量X','变量Y','变量Z']]\n",
    "df[['变量X']]\n",
    "df['变量X']\n",
    "```\n",
    "\n",
    "#### 列+行子集\n",
    "```python\n",
    "\n",
    "#  行子集\n",
    "df.loc[:,['变量X':'变量Z']]    # 注意中括号里的: 和 ,的使用\n",
    "df.iloc[:,[1,2,5]]\n",
    "df.loc[df['变量X']>10, ['变量X','变量Z'] ]   \n",
    "```\n",
    "\n",
    "子集代码片语说明(你来做笔记)\n",
    "* 列子集\n",
    "* 行子集\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 2 entries, 0 to 2\n",
      "Data columns (total 3 columns):\n",
      "排名          2 non-null int64\n",
      "企业名称        2 non-null object\n",
      "估值（亿人民币）    2 non-null int64\n",
      "dtypes: int64(2), object(1)\n",
      "memory usage: 64.0+ bytes\n"
     ]
    }
   ],
   "source": [
    "df.loc[[0,2],[\"排名\",\"企业名称\",\"估值（亿人民币）\"]].info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>Ant Financial</td>\n",
       "      <td>10000</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>2014</td>\n",
       "      <td>春华资本、中投海外、红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>Bytedance</td>\n",
       "      <td>5000</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>媒体和娱乐</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>2012</td>\n",
       "      <td>红杉资本、海纳亚洲、纪源资本、启明创投</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>Didi Chuxing</td>\n",
       "      <td>3600</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "      <td>程维</td>\n",
       "      <td>2012</td>\n",
       "      <td>腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   排名  企业名称   Company Name  估值（亿人民币）  国家  城市     行业 掌门人/创始人  成立年份  \\\n",
       "0   1  蚂蚁金服  Ant Financial     10000  中国  杭州   金融科技     井贤栋  2014   \n",
       "1   2  字节跳动      Bytedance      5000  中国  北京  媒体和娱乐     张一鸣  2012   \n",
       "2   3  滴滴出行   Didi Chuxing      3600  中国  北京   共享经济      程维  2012   \n",
       "\n",
       "                   部分投资机构  \n",
       "0          春华资本、中投海外、红杉资本  \n",
       "1     红杉资本、海纳亚洲、纪源资本、启明创投  \n",
       "2  腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df[\"估值（亿人民币）\"]> 3500]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![03_subset_columns_rows.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/03_subset_columns_rows.svg)\n",
    "### 切切切的小结\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "1. 1\n",
    "2. 2\n",
    "3. 3\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![04_plot_overview.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/04_plot_overview.svg)\n",
    "## 如何在熊猫中绘图？\n",
    "\n",
    "> <mark>绘绘绘</mark>，**绘图** ( 数据框.plot() ) 是数据科学家**以数据框为中心**的代码实践，减少以图表类型为开头的编程思维来作图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 绘绘绘的代码片语\n",
    "绘绘绘的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "```python\n",
    "df.plot()\n",
    "```\n",
    "\n",
    "代码片语说明\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x25aa5b7f708>"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD9CAYAAAC1DKAUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliL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/y29SR/Vp8KCNow53PxwGstfMoQAFABgxjzK9x34oYTD/8MyYi/UgbsNpae35PK+ki6uf8xPcI+tlvNvqZnu4K03MeYaw6PZZfzBh7rvHYfMMSyeGinoZJCr0W2sfkcFD4tllyzDo935Mc107OXZBYP3lnm14n/CmFjsT6yYnmUPcwRt2eyCtdfqH6hHF2S/bOOpRFnnokj0t4aqlKpVcl3of6VpN9EgvLw1NSEIb2cj0BFNq3dFnJ42LJzrGQyjdXPRp9PcIxD/v4kV/vVYBCnX+yAOm/zsINQ7yMe3xMvn7Sw7Jcry8ALxZYlivPXbjhoAxuyKjUvEst63z/Ob0sfN/9LdxwxUayF20+6QnX9NiySb3mkm+d9BBVOs/a1Oee8sz3mq+sIPn14lqyQS1Zl1zDVuk5hJBXvgAUOsb0HEO60wyGJbYrNdiF/JJj/DWJspPvk/Vowo3hp4cMIRs00sMsIY9c364L56/Rp1cn1k8GVYp8TZaVPhfhvGVSy3LVIznPQSKPMbjAMJbu7SQnDQENAH7iexDZSe/kaxjHzbUs1+t+3NhjT8ty5bmb7I9wMmXkXWpZdXSf7K/H/UGtE8jOQbyK+2Nf4C6MUbgfdJ3mX6fhfogzDdc5BO/j5jqSaR24seHTEnn8ETd3kl7n9MS2FjeJmKusDtzczN/h5lly5ZlPvrI24SYGq/37I3DfOx/j9+ld3Lj9GbiJzlNw48jn4ALpCf7zKX4/T8QF3jH+9WNfz/Q6Dbg5lX/HdfBH4c7f73G/jXjRr7cCuNLX7cNUXoVe02W94vf7NNyd8Hu4dnBMjnqEL3W8grthqcPNI9ThxujD63CyczzJZdv9scy13PhjMwl3E5JcP51/Ma/5ygp/kaCUeuTK+wNr7bkUoAAgIhIpDQGJiERKAUBEJFIKACIikVIAEBGJ1P8HY9UacDq+FW0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df[[\"估值（亿人民币）\"]].plot(kind=\"bar\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1cfa54f2348>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAADzCAYAAABqtMZNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAATdklEQVR4nO3de5CV1bnn8e/DTW6KiC3RoCIJFTVnBmI6MziiEYxTgvFIrMnReGLKYCSpMaFKLWdgNJo5VCI1kYlxEhMwYCxysdSZo7EEhymNJZ5IBM4xpNQkkwtmIEGQSyNXm+aZP3rTcmf37mZvZX0/VZbvft53v2utbvrXq9f77r0jM5EklaFHozsgSaofQ1+SCmLoS1JBDH1JKoihL0kF6dXoDhzOySefnMOHD290NyTpPWX58uVvZmbTwfa9q0N/+PDhLFu2rNHdkKT3lIh4/VD7XN6RpIIY+pJUEENfkgryrl7Tl9T9WltbWbVqFTt27Gh0V9RFffv2ZdiwYfTu3bvq5xj6UmFWrVrF8ccfz/Dhw4mIRndHNcpM1q9fz6pVqzjrrLOqfp7LO1JhduzYwZAhQwz897iIYMiQIZ3+i83Qlwpk4B8bavk+VhX6ETE0IhZXtntHxJMR8U8RMbmrNUlS/Rwx9CNiMPAQMKBS+gqwPDMvAP5DRBzfxZqkAu3evfuIx+y9dNHa2kpra+tRb3Nv27dvp62trUttHsrmzZv54x//eFTOfTjVXMhtA64Gnqg8vhiYVtl+HmjuYu3nezcWEVOAKQBnnHFG1QPZ2/BpT9X0vFqtnHl5XduTulN3/7xU+/Mwfvx4Zs+ezYc+9CEWLFjAokWLuPfee/c5ZtKkSUyfPp0zzzyTRYsWsXjxYmbMmEFbWxtnnnkmvXodOsJef/117rvvPmbNmtVR+973vkdbWxs33XQTPXv2PGIfZ8yYwYgRI/jCF75wwL5rr72WlStX0r9//33qr776KgsXLmTUqFGsXr2am2++mV27drFjxw62bNnCpk2beOONN2hra6O5uZmnn34agOnTpzN58mRGjhx5xH51xRFDPzM3wz5rRwOA1ZXtDcDQLtb2b28OMAegubnZj/WSjkErVqxg165dfPCDHwSgf//+9O3bF2i/KyUz+dOf/sRxxx3Hzp07efTRR1m6dCk7d+7kscceY9euXdx0000cf/zBFwu2bdvGLbfcwgMPPLBPff78+UyfPp3Ro0fTs2dP3n77bX7729/yyiuvcPbZZx9wnl69ejFw4MCDttG7d2/mzZt3wPOuv/56+vTpA8Cpp57K5MmTGThwIP379+eJJ57gfe97H1/84hfp0WPfhZZp06YxefJkHnzwQU444YQqvoq1qeWWzS1AP6AFGFh53JWapMJMnz6dSy65hE996lNs2rSJzZs3s2HDBpYsWUJrayszZsxg9uzZnHPOOXziE5/g7rvvZtWqVfTo0YOWlha++tWvHjLwAb773e9y6623ctJJJ3XUnnzySbZs2cKVV17JlVdeCcBtt93GlClTDhr4AFu2bOGtt9466L6IYPLkyQed6d9yyy0A9OjRg8suu6xj30svvUTfvn0PCHyAQYMGceedd/Ktb32Lu+6665Bj66paQn85MBZ4DBgFLOliTVJBfvzjH/OHP/yBj33sY/zsZz8D4LnnnuPpp59m5syZADz66KP86le/4qyzzqJHjx5s3bqV+fPnA/DUU0+xcePGw7axYsUKbrvtto7HW7du5fbbb++YgQP88pe/5He/+x3f/OY3D3meV199lc2bN3PjjTcedP+emf7jjz/On//8Z6ZOnXrAMZdccgnbtm3juOOO4y9/+Qs9evTghz/8ITt27ODEE0/sWN4BGDVqFPfcc89hx9ZVtYT+Q8CCiLgQOBf4Je1LNrXWJBVk8ODBzJo1i6VLl7JixQqmTp3Kpk2bOmb6n/nMZ7jwwgu59957ee6554D2C6q///3vAVi7du0R29h/rf/hhx9mypQp/OhH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G9c6Z/eWZesF/tHyPieOAi4LEG9KnbRMTzQH9g895lII+BH64BmfkfASLifOB/RcT0Bvepu3wE+Glm3h0RFwF/tycsIuK5hvase0wA7qH9xZr/OTM3R8TPj4F/k/v7m8wcAxAR9wP/DBj6DfZaRMwDHqH97SH6ARcC44F/aGTHusmngR8CV2fm5iMc+16zOyIuycxnMvPFiLiM9u/jqEZ3rBssB/5rRDyTmc8DzwNExHXA2w3tWTfIzDeA6yJiHO2TrPuBY2nJ4QMRcTcwICKGVsb74UZ3ao+iQz8zvxARn6J95jGA9pnHcuCiY2FNPzPfiIjPALsb3Zej4Brg74FnADJzQ0RMAG5oaK+6QWZujIjLgX+9365Tgb9rQJeOisz8eUS8AEwDeja6P91oBO3fuz8DwyJiI3A7cG1De1VR9Jq+JJXGWzYlqSCGviQVxNCXpIIY+pJUkP8PVRaldjXIhqAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib as mpl  \n",
    "mpl.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签  \n",
    "mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号 \n",
    "df = pd.read_csv(\"20春_pandas_week02_hurun_unicorn_more.csv\", encoding=\"utf8\", sep=\"\\t\")\n",
    "df.loc[[0,1,2,3,4,5],[\"估值（亿人民币）\"]].plot(kind=\"bar\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![04_plot_overview.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/04_plot_overview.svg)\n",
    "### 绘绘绘的小结\n",
    "\n",
    "1. 1\n",
    "2. 2\n",
    "3. 3\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![05_newcolumn_2.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/05_newcolumn_2.svg)\n",
    "## 如何从现有列创建派生新列？\n",
    "> <mark>列列列</mark>，派生新列意谓着变数variables的进一部转换，是数据科学家按步就班做ETL的过程，新派生列就是**变数variables**的转换\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 列列列的代码片语\n",
    "列列列的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "```python\n",
    "\n",
    "df['新变量'] = df['变量X'] + df['变量Y']\n",
    "df['新变量'] = [ 转换(x) for x in df['变量Y'] ]     # 列表推导转换\n",
    "\n",
    "```\n",
    "\n",
    "代码片语说明\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![05_newcolumn_2.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/05_newcolumn_2.svg)\n",
    "### 列列列的小结\n",
    "\n",
    "1. 1\n",
    "2. 2\n",
    "3. 3\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![06_groupby.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/06_groupby.svg)\n",
    "\n",
    "## 如何计算汇总描述性统计信息？\n",
    "算算算，描述性统计竟然代码可以这麽容易....，但难的仍是在数据科学家的数据定义及解释上"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 算算算的代码片语\n",
    "算算算的代码片语 (code snippets)，新手请认真记忆，**注意标点及缩进**\n",
    "\n",
    "```python\n",
    "\n",
    "df.describe()\n",
    "df.describe(include=all)\n",
    "\n",
    "df.count()\n",
    "df.sum()\n",
    "\n",
    "df.min()\n",
    "df.max()\n",
    "df.mean()\n",
    "df.median()\n",
    "\n",
    "df.var()\n",
    "df.std()\n",
    "```\n",
    "\n",
    "代码片语说明\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![06_groupby.svg](https://pandas.pydata.org/pandas-docs/version/1.0.2/_images/06_groupby.svg)\n",
    "### 算算算的小结预告\n",
    "\n",
    "1. 1\n",
    "2. 2\n",
    "3. 3\n",
    "\n",
    "<div class=\"emoticon\">😃😄😁</div>\n",
    "\n",
    "----- \n",
    "----- "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 本周我的总结"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
